<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/WEB-INF/templates/cadProfis.xhtml">
    <ui:param name="pPageTitle" value="Passo 3 de 5 | Formações" />
    <ui:define name="formulario">
        <p:toolbar>
            <p:toolbarGroup align="left">
                <p:commandButton action="#{formacaoView.voltar}" ajax="false"
                                 value="Voltar" icon="ui-icon-arrowthick-1-w" />
            </p:toolbarGroup>
            <p:toolbarGroup align="right">
                <p:commandButton action="#{formacaoView.seguinte}" ajax="false"
                                 value="Próximo" icon="ui-icon-arrowthick-1-e" />
            </p:toolbarGroup>
        </p:toolbar>    
        <p:spacer width="20px"/>

        <h:panelGrid columns="2" cellpadding="2" columnClasses="textAlignRight,textAlignLeft">  
            <p:outputLabel for="tipForm" value="${label['profis.tipF']}" />
            <p:selectOneMenu id="tipForm" value="#{formacaoView.formacao.tipo}" 
                             label="${label['profis.tipF']}" rendered="true">
                <f:selectItem itemLabel="Selecione uma opção" noSelectionOption="true"/>
                <f:selectItems value="#{formacaoView.optFormacoes}"/>
            </p:selectOneMenu>  

            <p:outputLabel for="desc" value="${label['profis.desc']} *"/>
            <p:inputText id="desc" value="#{formacaoView.formacao.descricao}" 
                         label="${label['profis.desc']}" style="text-transform: capitalize" size="50"/>
            
            <p:outputLabel for="instit" value="${label['profis.forInst']} *" />
            <p:inputText id="instit" value="#{formacaoView.formacao.instituicao}" label="${label['profis.forInst']}" 
                         size="60" maxlength="99" style="text-transform: capitalize"/>

            <p:outputLabel for="anoIni" value="${label['profis.forIni']} *"/>
            <p:inputMask id="anoIni" value="#{formacaoView.formacao.anoini}" 
                         label="${label['profis.forIni']}" mask="?9999" size="10"/>

            <p:outputLabel for="durac" value="${label['profis.forDura']}"/>
            <p:inputMask id="durac" value="#{formacaoView.formacao.duracao}" 
                         label="${label['profis.forDura']}" mask="?999" size="10"/>

            <h:outputText value=""/> 
            <p:commandButton update="tbFormacoes" action="#{formacaoView.actionSalvar}" 
                             value="${label['btnSalvar.label']}" icon="ui-icon-arrowthick-1-s" /> 
        </h:panelGrid>

        <p:dataTable id="tbFormacoes" value="#{formacaoView.formacoes}" var="formac" emptyMessage="Não existem formações" paginator="true"  rowsPerPageTemplate="5,10,15"
                     paginatorPosition="bottom" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">  
            <p:column headerText="${label['profis.tipF']}">  
                <h:outputText value="#{formac.tipo}"/>  
            </p:column>  
            <p:column headerText="${label['profis.forInst']}">  
                <h:outputText value="#{formac.instituicao}" />  
            </p:column>    
            <p:column headerText="${label['profis.desc']}">  
                <h:outputText value="#{formac.descricao}" />  
            </p:column>    
            <p:column headerText="${label['profis.forIni']}">  
                <h:outputText value="#{formac.anoini}"/>  
            </p:column>
            <p:column headerText="${label['profis.forDura']}">  
                <h:outputText value="#{formac.duracao}" />  
            </p:column>
        </p:dataTable> 

        <p:spacer width="20px"/>
        <h:outputText value="Os campos com ( * ) são de preenchimento obrigatório" style="color: red"/>
    </ui:define>
</ui:composition>